package com.tianqu.tms.www.transfer.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.entity.TransferStatusCount;
import com.tianqu.tms.www.transfer.viewhelper.CheckConfirmViewHelper;

public class SpecialCarStatusInputAction extends TmsAction {

	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {
		//载入最新的日期
		CheckConfirmViewHelper view = new CheckConfirmViewHelper();
		if(uc.getAttribute(TmsConstants.VIEWHELP)!=null)
		{
			view = (CheckConfirmViewHelper)uc.getAttribute(TmsConstants.VIEWHELP);
		}
		if("1".equals(view.getTsBsFlag()))
		{ 
			TransferStatusCount count = new TransferStatusCount();
			count = count.getTransferStatusCountInfo("");
			
			if(count!=null)
			{
				view.setStatusSearchTime(count.getCountDay());
			}else{
				//不显示 区间和查询按钮
				view.setStatusSearchTime("");
			}
		}
		request.setAttribute(TmsConstants.VIEWHELP, view);
		return mapping.findForward(TmsConstants.SUCCESS);
	}

}
